package com.itheima.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.itheima.common.DefaultException;
import com.itheima.dto.OrganizationDto;
import com.itheima.dto.RoleDto;
import com.itheima.entity.Organization;
import com.itheima.vo.organization.OrganizationBriefVo;
import com.itheima.vo.organization.OrganizationDetailVo;
import com.itheima.vo.organization.OrganizationVo;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @author 51585
 * @description 针对表【organization】的数据库操作Service
 * @createDate 2022-10-05 17:11:24
 */
public interface OrganizationService extends IService<Organization> {

    /**
     * 查找当前用户能向下管理的权限
     *
     * @return
     * @throws Exception
     */
    OrganizationVo findRole() throws Exception;

    /**
     * 更新用户权限
     *
     * @param roleDto
     * @return
     * @throws Exception
     */
    void updateRole(RoleDto roleDto) throws Exception;


    /**
     * 新增组织
     *
     * @param organizationDto
     * @throws Exception
     */
    void insertOrganization(OrganizationDto organizationDto) throws Exception;

    /**
     * 更新组织信息（名称）
     *
     * @param organizationDto
     * @throws Exception
     */
    void updateOrganization(OrganizationDto organizationDto) throws Exception;

    /**
     * 删除组织
     *
     * @param organizationId
     * @throws Exception
     */
    void deleteOrganization(Integer organizationId) throws Exception;

    /**
     * 展示组织详情
     * @param organizationId 组织id
     * @return 组织详情vo
     * @throws DefaultException 异常
     */
    OrganizationDetailVo showDetail(Integer organizationId) throws DefaultException;

    /**
     * 展示组织列表
     * @param keyword 关键字
     * @return 组织简略信息vo
     */
    List<OrganizationBriefVo> listOrganization(String keyword);

    /**
     * 导出组织下用户信息
     * @param organizationId 组织id
     * @param response 响应对象
     */
    void excelExport(Integer organizationId, HttpServletResponse response) throws IOException;
}
